const { Service } = require('egg')

class PlanService extends Service{

    /**
     * 查询履历列表
     */
    async list(){
        const { ctx } = this;
        return await ctx.model.ResumeLog.findAll({
            order: [['time', 'DESC']]
        })
    }


    async page(){
        const { ctx } = this;
        return await ctx.model.ResumeLog.findAll({
            order: [['time', 'DESC']]
        })
    }

    /**
     * 履历修改
     */
    async update(payload){
        return await this.ctx.model.ResumeLog.update(payload, {
            where: {
                id: payload.id
            }
        })
    }

    /**
     * 履历添加
     */
    async create(payload){
        return await this.ctx.model.ResumeLog.create(payload)
    }

    /**
     * 履历删除
     */
    async delete(payload){
        return await this.ctx.model.ResumeLog.destroy({
            where: {
                id: payload.id
            }
        })
    }

}


module.exports = PlanService